﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XMLSpreadGear.Core;

namespace XMLSpreadGear.Headers
{
    public class Protection:BaseElement
    {

         public Protection(string strlocalname)
            : base(strlocalname)
        {

        }

         public Protection(string strlocalname, bool isprotected, bool hideformula)
            : this(strlocalname)
        {
            this.Protected = isprotected;
            this.HideFormula = hideformula;
        }


        bool? m_Protected;
        bool? m_HideFormula;


       
        public bool? Protected
        {
            get { return m_Protected; }
            set { m_Protected = value; }
        }
      
        public bool? HideFormula
        {
            get { return m_HideFormula; }
            set { m_HideFormula = value; }
        }

        internal override string GetAttributeNamespace()
        {
            return Contstants.SpredsheetAttributePrefix;
        }

        internal override string GetAttributeNamespaceURI()
        {
            return Contstants.SpredsheetAttributeNamespace;
        }

        internal protected override IDictionary<string, string> RegisterAttributes()
        {
            IDictionary<string, string> dic = new Dictionary<string, string>();
            if(this.Protected != null)
                dic.Add("Protected", this.Protected.ToByte().ToString());

            if(this.HideFormula != null)
                dic.Add("HideFormula", this.HideFormula.ToByte().ToString());

            return dic;
        }

        internal protected override IDictionary<string, string> RegisterElements()
        {
            IDictionary<string, string> dic = new Dictionary<string, string>();
            return dic;
        }


        protected override void SetDefaults()
        {
            return;
        }
    }
}
